package com.zhentao.controller;

import com.zhentao.Result.ResultVo;
import com.zhentao.dto.GoodsDto;
import com.zhentao.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    @RequestMapping("add")
    public int add(@RequestBody GoodsDto dto){
        return goodsService.add(dto);
    }

    @RequestMapping("insert")
    public ResultVo ini(Integer goodsId, HttpServletRequest request){
        ResultVo ini = goodsService.ini(goodsId, request);
        return ini;
    }
}
